<template>
  <div class="user-info">
    <el-dropdown>
      <div class="ljm-dropdown-wrap">
        <el-avatar
          src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
        ></el-avatar>
        <span class="user-name">{{ name }}</span>
      </div>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item icon="el-icon-circle-close"
            >退出登录</el-dropdown-item
          >
          <el-dropdown-item>用户信息</el-dropdown-item>
          <el-dropdown-item>用户信息</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { useStore } from '@/store'

export default defineComponent({
  setup() {
    const store = useStore()

    const name = store.state.login.userInfo.name
    return {
      name
    }
  }
})
</script>

<style scoped lang="less">
.user-info {
  ::v-deep {
    .el-dropdown {
      display: flex !important;
      align-items: center !important;
    }
    .ljm-dropdown-wrap {
      cursor: pointer;
      display: flex !important;
      align-items: center !important;
      .user-name {
        margin-left: 8px;
      }
    }
  }
}
</style>
